<!DOCTYPE html>
<html>
<head>
    <title>Snake Game</title>
    <style>
        body {
            display: flex;
            align-items: center;
            background-color: #f0f0f0;
            font-family: Arial, sans-serif;
            margin: 20px;
            gap: 20px;
        }
        .game-container {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        #gameCanvas {
            border: 2px solid #333;
            background-color: white;
        }
        .game-info {
            display: flex;
            gap: 20px;
            margin-top: 10px;
            font-size: 20px;
            justify-content: center;
            width: 100%;
        }
        .info-item {
            padding: 5px 15px;
            background-color: #333;
            color: white;
            border-radius: 5px;
        }
        .control-panel {
            display: flex;
            flex-direction: column;
            gap: 20px;
            width: 250px;
        }
        #restartBtn {
            padding: 15px 30px;
            font-size: 20px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        #restartBtn:hover {
            background-color: #45a049;
        }
        .instructions {
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        .instructions h2 {
            margin-top: 0;
            color: #333;
            font-size: 20px;
        }
        .instructions p {
            margin: 10px 0;
            color: #666;
            line-height: 1.5;
        }
        .key {
            background-color: #eee;
            padding: 2px 8px;
            border-radius: 3px;
            font-family: monospace;
            color: #333;
        }
    </style>
</head>
<body>
    <div class="game-container">
        <canvas id="gameCanvas" width="400" height="400"></canvas>
        <div class="game-info">
            <div class="info-item">Time: <span id="timer">0:00</span></div>
            <div class="info-item">Score: <span id="score">0</span></div>
            <div class="info-item">Combo: <span id="combo">x1</span></div>
            <div class="info-item">Speed: <span id="speed">5.0</span> 格/秒</div>
        </div>
    </div>
    <div class="control-panel">
        <button id="restartBtn">重新开始</button>
        <div class="instructions">
            <h2>游戏说明</h2>
            <p><strong>控制：</strong><br>
                <span class="key">↑</span> 向上移动<br>
                <span class="key">↓</span> 向下移动<br>
                <span class="key">←</span> 向左移动<br>
                <span class="key">→</span> 向右移动<br>
                <span class="key">Space</span> 重新开始
            </p>
            <p><strong>规则：</strong><br>
                - 吃到食物得10分<br>
                - 每100分加速1格/秒<br>
                - 5秒内连续吃到食物可以获得连击加成<br>
                - 连击期间速度加快，分数翻倍<br>
                - 碰到自己身体游戏结束
            </p>
        </div>
    </div>
    <script src="game.js"></script>
</body>
</html>
